﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AuthorizeEdit.ascx.cs"
    Inherits="VDC.VONE.WEB.Modules.Authorize.Controls.AuthorizeEdit" %>
<%@ Import Namespace="VDC.COMMON" %>
<%@ Register Assembly="ASTreeView" Namespace="Geekees.Common.Controls" TagPrefix="cc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register TagPrefix="cc1" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit, Version=4.1.7.429, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e" %>
<style>
    div.ajax__dropdown_frame_line {
        border: 1px solid #cccccc;
    }
</style>

<table class="tbl_data" width="97%" cellspacing="0" cellpadding="0" align="center">
    <tr>
        <th align="left" valign="middle" style="border-right: 0px; padding-left: 8px" class="tab_selected">
            <img width="24" height="26" align="absmiddle" style="padding-right: 8px;" alt=""
                src='<%=this.ResolveUrl("~/Images/note.png") %>'>
            <asp:Label runat="server" ID="lblHeader" Text="QUẢN LÝ ỦY QUYỀN" />
        </th>
    </tr>
    <tr>
        <td>
            &nbsp;
        </td>
    </tr>
    <tr>
        <td>
            <table cellpadding="0" cellspacing="1" width="100%">
                <tr>
                    <td class="css_gchu" style="width: 17%;">
                        Người ủy quyền:
                    </td>
                    <td class="css_gchu">
                        <asp:TextBox ID="txtAuthorizeUser" Font-Bold="False" CssClass="css_ma" Enabled="False" ReadOnly="True" Width="250px" runat="server" TabIndex="1"/>
                    </td>
                </tr>
                <tr>
                    <td class="css_gchu">
                        Người được ủy quyền:<span class="emphas">*</span>
                    </td>
                    <td class="css_gchu">
                        <asp:DropDownList ID="ddlAuthorizeBeenUser" CssClass="css_ma focus" runat="server" Width="230px"
                            MaxLength="500" TabIndex="2"/>
                        <asp:RequiredFieldValidator ID="rfOrder" runat="server" ControlToValidate="ddlAuthorizeBeenUser" SetFocusOnError="True"
                            ForeColor="Red" Display="Dynamic" ErrorMessage="<br/>Người được ủy quyền không được trống."
                            ValidationGroup="btok" />
                    </td>
                </tr>
                <tr>
                    <td class="css_gchu" style="width: 17%;">
                        Chọn phòng ban, vị trí:<span class="emphas">*</span>
                    </td>
                    <td class="css_gchu">
                        <asp:UpdatePanel ID="pnlUpdate" runat="server">
                            <ContentTemplate>
                                <div class="css_gchu">
                                    <asp:TextBox CssClass="css_ma" style="background:url('../../../Scripts/Javascript/asdropdowntreeview/images/imgdropdown.png') no-repeat right center;" 
                                    ID="txtUserDepartment" runat="server" Width="400px" ReadOnly="true" TabIndex="3"/>
                                    <asp:TextBox runat="server" ID="txtUserDepartmentHidden" style="display: none" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtUserDepartmentHidden"
                                    ForeColor="Red" Display="Dynamic" ErrorMessage="<br/>Phòng ban, vị trí đầu không được trống." ValidationGroup="btok" />
                                    <asp:Panel runat="server" ID="pnlGridView" Style="max-height: 150px; overflow-y: scroll; display: none; visibility: hidden; border: 1px solid gray;">
                                        <asp:GridView ID="grdView" CssClass="grid_hs_tbl" DataKeyNames="UserDepartmentId" CellPadding="0" CellSpacing="0"
                                            GridLines="None" AutoGenerateColumns="False" runat="server"
                                            OnSelectedIndexChanged="GrdView_OnSelectedIndexChanged"
                                            OnRowDataBound="GrdView_RowDataBound">
                                            <Columns>
                                                <asp:TemplateField HeaderText="STT">
                                                    <HeaderStyle CssClass="grid_hs" HorizontalAlign="Center"></HeaderStyle>
                                                    <ItemTemplate>
                                                        <%# Container.DataItemIndex + 1 %>
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Center"></ItemStyle>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Phòng ban">
                                                    <HeaderStyle CssClass="grid_hs" HorizontalAlign="Center"></HeaderStyle>
                                                    <ItemTemplate>
                                                        <%#PublicFuncs.HtmlEncode(Eval("Department.Name"))%>
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderText="Chức vụ">
                                                    <HeaderStyle CssClass="grid_hs" HorizontalAlign="Center"></HeaderStyle>
                                                    <ItemTemplate>
                                                        <%#PublicFuncs.HtmlEncode(Eval("Position.Name"))%>
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Left"></ItemStyle>
                                                </asp:TemplateField>
                                            </Columns>
                                            <SelectedRowStyle BackColor="#999999" />
                                            <PagerStyle HorizontalAlign="Right" BackColor="#FFFFFF"></PagerStyle>
                                            <PagerTemplate>
                                                <table id="paging">
                                                    <tr>
                                                        <td>
                                                            <div class="Portalpages">
                                                                <asp:PlaceHolder ID="pageHolder" runat="server"></asp:PlaceHolder>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </PagerTemplate>
                                        </asp:GridView>
                                    </asp:Panel>
                                    <cc1:DropDownExtender ID="DropDownExtender1" runat="server" DropDownControlID="pnlGridView" DropArrowImageUrl="~/Scripts/Javascript/asdropdowntreeview/images/imgdropdown.png"
                                        TargetControlID="txtUserDepartment">
                                    </cc1:DropDownExtender>
                                </div>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td class="css_gchu">
                        Ngày bắt đầu:<span class="emphas">*</span>
                    </td>
                    <td class="css_gchu">
                       <asp:TextBox ID="txtStartDate" CssClass="css_ma datetime" runat="server" Width="100px" MaxLength="10" TabIndex="4" />
                        <asp:Image runat="server" ID="imgCalendar1" ImageUrl="~/Images/calendar.png" align="absmiddle" />
                        <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtStartDate"
                            Format="dd/MM/yyyy" PopupButtonID="imgCalendar1">
                        </asp:CalendarExtender>
                        <asp:RegularExpressionValidator ID="rfStartDate" runat="server" ForeColor="Red" ErrorMessage="<br/>Ngày bắt đầu không hợp lệ." SetFocusOnError="True"
                            ControlToValidate="txtStartDate" Display="Dynamic" ValidationExpression="(^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$)|(__/__/____)"
                            ValidationGroup="btok"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtStartDate" SetFocusOnError="True"
                            ForeColor="Red" Display="Dynamic" ErrorMessage="<br/>Ngày bắt đầu không được trống."
                            ValidationGroup="btok" />
                        <asp:CompareValidator ID="CompareValidator3" runat="server" Type="Date" ControlToValidate="txtStartDate" SetFocusOnError="True"
                            ForeColor="Red" Display="Dynamic" ErrorMessage="<br/>Ngày bắt đầu phải lớn hơn hoặc bằng ngày hiện tại." Operator="GreaterThanEqual"
                            ValueToCompare="<%# DateTime.Now.ToString(VDC.COMMON.Constants.DateTimeDisplay) %>"
                            ValidationGroup="btok" />
                    </td>
                </tr>
                <tr>
                    <td class="css_gchu">
                        Ngày kết thúc:<span class="emphas">*</span>
                    </td>
                    <td class="css_gchu">
                        <asp:TextBox ID="txtEndDate" CssClass="css_ma datetime" runat="server" Width="100px" MaxLength="10"
                            TabIndex="5" />
                        <asp:Image runat="server" ID="imgCalendar" ImageUrl="~/Images/calendar.png" align="absmiddle" />
                        <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtEndDate"
                            Format="dd/MM/yyyy" PopupButtonID="imgCalendar">
                        </asp:CalendarExtender>         
                        <asp:RegularExpressionValidator ID="rfEndDate" runat="server" ForeColor="Red" ErrorMessage="Ngày kết thúc không hợp lệ." SetFocusOnError="True"
                            ControlToValidate="txtEndDate" Display="Dynamic" ValidationExpression="(^((((0[1-9])|([1-2][0-9])|(3[0-1]))|([1-9]))\x2F(((0[1-9])|(1[0-2]))|([1-9]))\x2F(([0-9]{2})|(((19)|([2]([0]{1})))([0-9]{2}))))$)|__/__/____"
                            ValidationGroup="btok"></asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtEndDate" SetFocusOnError="True"
                            ForeColor="Red" Display="Dynamic" ErrorMessage="<br/>Ngày kết thúc không được trống."
                            ValidationGroup="btok" />
                        <asp:CompareValidator ID="CompareValidator2" runat="server" Type="Date" ControlToValidate="txtEndDate" ControlToCompare="txtStartDate" SetFocusOnError="True"
                            ForeColor="Red" Display="Dynamic" ErrorMessage="<br/>Ngày kết thúc phải lớn hơn hoặc bằng Ngày bắt đầu." Operator="GreaterThanEqual"
                            ValidationGroup="btok" />
                        <asp:CompareValidator ID="CompareValidator1" runat="server" Type="Date" ControlToValidate="txtEndDate"
                            ForeColor="Red" Display="Dynamic" ErrorMessage="<br/>Ngày kết thúc phải lớn hơn hoặc bằng ngày hiện tại." Operator="GreaterThanEqual" SetFocusOnError="True"
                            ValueToCompare="<%# DateTime.Now.ToString(VDC.COMMON.Constants.DateTimeDisplay) %>"
                            ValidationGroup="btok" />
                    </td>
                </tr>

            </table>    
        </td>
    </tr>
    <tr>
        <td align="center">
            <asp:Label ID="lbError" runat="server" ForeColor="red" />
        </td>
    </tr>
    <tr>
        <td>
            &nbsp;
        </td>
    </tr>
    <tr>
        <td>
            <table cellspacing="1" cellpadding="0">
                <tbody>
                    <tr>
                        <td>
                            <asp:Button ID="btnSave" CssClass="css_button default" runat="server" OnClick="Save_Click" TabIndex="6"
                                Text="Ghi lại" ValidationGroup="btok" />
                        </td>
                        <td>
                            <asp:Button ID="btnSaveAndNew" CssClass="css_button validation" runat="server" OnClick="SaveAndNew_Click" TabIndex="7"
                                Text="Ghi lại &amp; Thêm mới" ValidationGroup="btok" />
                        </td>
                        <td>
                            <asp:Button ID="btnDelete" CssClass="css_button" OnClientClick="return confirm('Bạn có chắc chắn muốn xóa?');" TabIndex="8"
                                runat="server" Text="Xóa bỏ" OnClick="Delete_Click" CausesValidation="False"
                                ValidationGroup="btok" />
                        </td>
                        <td>
                            <asp:Button ID="btnCancel" CssClass="css_button" runat="server" OnClick="Cancel_Click" TabIndex="9"
                                Text="Hủy bỏ" />
                        </td>
                        <td>
                            <asp:Button ID="btnBack" CssClass="css_button" runat="server" OnClick="Back_Click" TabIndex="10"
                                Text="Quay lại" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </td>
    </tr>
</table>


